package cc.customer.bigEmport.services.imp;

import cc.customer.bigEmport.damain.EprRecords;
import cc.customer.bigEmport.services.BigEprRecords;
import cc.customer.common.service.impl.BaseService;
import cc.customer.system.domain.MyUser;
import cc.customer.utils.AutonCusInfo;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import tk.mybatis.mapper.entity.Example;

import java.util.ArrayList;
import java.util.List;

@Service("bigEprRecords")
@Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class)
public class BigEprRecordsImp extends BaseService<EprRecords> implements BigEprRecords {

    private static  final Logger logger = LoggerFactory.getLogger(BigEprRecordsImp.class);

    @Override
    public List<EprRecords> getEprRecordsByExportUuid(String exportUuid, MyUser user) {
        try {
            Example example =  new Example(EprRecords.class);
            example.createCriteria().andEqualTo("cEprBacthUuid",exportUuid);
            List<EprRecords> list = this.selectByExample(example);
            for (EprRecords eprRecords :list){
                AutonCusInfo.parseRecords(eprRecords,user);
            }
            return list;
        }catch (Exception e){
            logger.error("获取当前导出记录的uuid 失败客户的信息失败："+e.getMessage());
        }
        return new ArrayList<>();
    }

    /**
     * 获取导入失败的人数
     * **/



}
